package com.xpand.guava;


import com.google.common.base.MoreObjects;

import static com.google.common.base.Objects.equal;
import static com.google.common.base.MoreObjects.toStringHelper;

/**
 * @Author: wei.wang
 * @Description: Guava Object 类使用
 * @Date 2017/12/25 18:04
 * @Modified
 */
public class ObjectTest {
    public static void main(String[] args) {
        Object o1 = new Object();
        Object o2 = new Object();
        Integer i1 = new Integer(12345);
        Integer i2 = new Integer(12345);

        // equal 方法当对象、值有其一相等时返回true
        System.out.println(equal(o1, o2));
        System.out.println("值比较：" + equal(i1, i2));
        System.out.println("对象比较：" + (i1 == i2));

        // toString
        System.out.println(toStringHelper(ObjectTest.class).add("x", 1));
    }
}
